package com.fuxi.cloud.desreport.a;

import com.fuxi.cloud.common.vo.Result;
import com.fuxi.cloud.desreport.entity.JimuReportShare;
import com.fuxi.cloud.desreport.service.IJimuReportShareService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * b
 *
 * @Author: 扫地僧
 * @CreateTime: 2021-05-03
 */
@RestController("jimuReportShareController")
@RequestMapping({"/jmreport/share"})
public class f {
    private static final Logger a = LoggerFactory.getLogger(f.class);
    @Autowired
    private IJimuReportShareService jurisdictionService;

    public f() {
    }

    @GetMapping({"/queryJurisdiction"})
    public Result<JimuReportShare> a(@RequestParam(name = "reportId") String var1) {
        Result var2 = new Result();
        JimuReportShare var3 = this.jurisdictionService.selectJurisdiction(var1);
        if (null != var3) {
            var3 = this.jurisdictionService.compareToDate(var3);
        }

        var2.setSuccess(true);
        var2.setResult(var3);
        return var2;
    }

    @PostMapping({"/addAndEdit"})
    public Result<?> a(@RequestBody JimuReportShare var1) {
        try {
            JimuReportShare var2 = this.jurisdictionService.addAndEdit(var1);
            return Result.OK(var2);
        } catch (Exception var3) {
            a.error(var3.getMessage(), var3);
            return Result.error("保存失败！");
        }
    }

    @GetMapping({"/verification"})
    public Result<String> a(@RequestParam(name = "reportId") String var1, @RequestParam(name = "lock",required = false) String var2) {
        String var3 = this.jurisdictionService.passwordVerification(var1, var2);
        return Result.OK(var3);
    }
}
